home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.11 Nov 91 / TPose Source / DemoText Patches / UTEDocument.inc1.p.df < prev    next >
Encoding:
Text File  |  1991-05-23  |  8.8 KB  |  301 lines  |  [TEXT/MPS ]

  1. File #1: Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p
  2. File #2: MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p
  3.  
  4. Extra lines in 1st before 6 in 2nd (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 6:89; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line Δ6)
  5. USES
  6.     { • Building Blocks }
  7.     UDialog,                                    { JLP: needed by UCharacterDialog }
  8.     UGridView,                                    { JLP: needed by UCharacterDialog }
  9.  
  10.     { • Required for this unit's interface }
  11.     UMenuItemCommand,                            { JLP: needed by UCharacterDialog }
  12.     UCharacterDialog,
  13.  
  14.     { • Implementation use }
  15.     ToolUtils, Fonts, Resources, Script, Picker;
  16.  
  17.  
  18.     {###########################################################################
  19.     PRIVATE CLASSES
  20.     ###########################################################################}
  21.  
  22. TYPE
  23.     {###########################################################################
  24.     TTECharDialogCmd
  25.         This class overrides CreateTheCommand() — its the only method that
  26.         needs to know about the application data structures.
  27.     ###########################################################################}
  28.     
  29.     TTECharDialogCmd        = OBJECT(TCharacterDialogCmd)
  30.         { ITECharDialogCmd(): Just passes its arguments to ICharacterDialogCmd. }
  31.         PROCEDURE TTECharDialogCmd.ITECharDialogCmd(
  32.                                 itsCmdNumber:        CmdNumber;
  33.                                 itsDocument:        TDocument;
  34.                                 itsView:            TView;
  35.                                 itsScroller:        TScroller;
  36.                                 itsTextStyle:        TextStyle;
  37.                                 itsAlignment:        INTEGER);
  38.         
  39.         { CreateTheCommand():  Creates the command that is to be posted when
  40.           the user accepts the dialog. }
  41.         FUNCTION  TTECharDialogCmd.CreateTheCommand
  42.                                 : TCommand;
  43.                                 OVERRIDE;
  44.                         
  45.         {$IFC qInspector}
  46.         PROCEDURE TTECharDialogCmd.Fields(
  47.                                 PROCEDURE DoToField(
  48.                                     fieldName:        Str255;
  49.                                     fieldAddr:        Ptr;
  50.                                     fieldType:        INTEGER));
  51.                                 OVERRIDE;
  52.         {$ENDC qInspector}
  53.         END;  { TTECharDialogCmd }
  54.  
  55.  
  56.     {###########################################################################
  57.     TTEStyleAndAlignCmd
  58.         Changes the style and/or the alignment, as indicated by the given mode.
  59.         (Alignment and justification are synonymous.)
  60.     ###########################################################################}
  61.     
  62.     TTEStyleAndAlignCmd        = OBJECT(TTEStyleCommand)
  63.         fOldAlignment:        INTEGER;
  64.         fNewAlignment:        INTEGER;
  65.         
  66.         PROCEDURE TTEStyleAndAlignCmd.ITEStyleAndAlignCmd(
  67.                                 itsTEView:            TTEView;
  68.                                 itsTextStyle:        TextStyle;
  69.                                 itsCmdNumber:        CmdNumber;
  70.                                 itsMode:            INTEGER;
  71.                                 itsAlignment:        INTEGER);
  72.  
  73.         PROCEDURE TTEStyleAndAlignCmd.DoIt;
  74.                                 OVERRIDE;
  75.  
  76.         PROCEDURE TTEStyleAndAlignCmd.UndoIt;
  77.                                 OVERRIDE;
  78.                         
  79.         {$IFC qInspector}
  80.         PROCEDURE TTEStyleAndAlignCmd.Fields(
  81.                                 PROCEDURE DoToField(
  82.                                     fieldName:        Str255;
  83.                                     fieldAddr:        Ptr;
  84.                                     fieldType:        INTEGER));
  85.                                 OVERRIDE;
  86.         {$ENDC qInspector}
  87.         END;  { TTEStyleAndAlignCmd }
  88.  
  89.  
  90.  
  91. Nonmatching lines (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 395:428; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line 311)
  92. {--------------------------------------------------------------------------------------------------}
  93.  
  94.     { DoCharacter():  Creates the command that poses the Character dialog (JLP). }
  95.     PROCEDURE DoCharacter;
  96.         VAR
  97.             theCmd:            TTECharDialogCmd;
  98.             offset:            INTEGER;
  99.             theTextStyle:    TextStyle;
  100.             lineHeight:        INTEGER;
  101.             fontAscent:        INTEGER;
  102.  
  103.         BEGIN
  104.         TEGetStyle(fTEView.fHTE^^.selStart,
  105.                    theTextStyle,
  106.                    lineHeight,
  107.                    fontAscent,
  108.                    fTEView.fHTE);
  109.         
  110.         New(theCmd);
  111.         FailNil(theCmd);
  112.         theCmd.ITECharDialogCmd(
  113.                     cCharacter,                        { command number }
  114.                     SELF,                            { document }
  115.                     fTEView,                        { view }
  116.                     fTEView.GetScroller(TRUE),        { scroller }
  117.                     theTextStyle,                    { TextStyle }
  118.                     fTEView.fJustification);        { alignment }
  119.         
  120.         DoMenuCommand := theCmd;
  121.         END;  { DoCharacter }
  122.  
  123. {--------------------------------------------------------------------------------------------------}
  124.  
  125.     BEGIN  { DoMenuCommand }
  126.  
  127.     BEGIN                                                { DoMenuCommand }
  128.  
  129.  
  130. Extra lines in 1st before 350 in 2nd (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 467:469; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line Δ350)
  131.             cCharacter:                { JLP }
  132.                 DoCharacter;
  133.  
  134.  
  135.  
  136. Extra lines in 1st before 542 in 2nd (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 662:663; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line Δ542)
  137.         
  138.     Enable(cCharacter, TRUE);                            { JLP }
  139.  
  140.  
  141. Extra lines in 1st file (File "Mr. Disk:Articles:TPoseDialogCmd:Source, etc.:UTEDocument.inc1.p"; Line 888:1044; File "MacII:MPW:MacApp 2.0.1:Examples:DemoText:UTEDocument.inc1.p"; Line 765Δ)
  142.  
  143.  
  144. {###############################################################################
  145. TTECharDialogCmd
  146. ###############################################################################}
  147.  
  148. {——————————————————————————————————————————————————————————————————————————————}
  149. {$S ASelCommand}    
  150.  
  151. PROCEDURE TTECharDialogCmd.ITECharDialogCmd(
  152.                         itsCmdNumber:        CmdNumber;
  153.                         itsDocument:        TDocument;
  154.                         itsView:            TView;
  155.                         itsScroller:        TScroller;
  156.                         itsTextStyle:        TextStyle;
  157.                         itsAlignment:        INTEGER);
  158.     
  159.     BEGIN
  160.     ICharacterDialogCmd(
  161.         itsCmdNumber,
  162.         itsDocument,
  163.         itsView,
  164.         itsScroller,
  165.         itsTextStyle,
  166.         itsAlignment);
  167.     END;  { ITECharDialogCmd }
  168.     
  169. {——————————————————————————————————————————————————————————————————————————————}
  170. {$S ADoCommand}
  171.  
  172. { CreateTheCommand():  Creates the command that is to be posted when
  173.   the user accepts the dialog. }
  174. FUNCTION  TTECharDialogCmd.CreateTheCommand
  175.                         : TCommand;
  176.                         OVERRIDE;
  177.     VAR
  178.         oldTextStyle:    TextStyle;
  179.         newTextStyle:    TextStyle;
  180.         newAlign:        INTEGER;
  181.         aCmd:            TTEStyleAndAlignCmd;
  182.     
  183.     BEGIN
  184.     oldTextStyle := fTextStyle;                          { localize }
  185.     
  186.     { get the current TextEdit and alignment states from the Character Dialog }
  187.     TCharDialogView(fTheDialog).GetDialogInfo(newTextStyle, newAlign);
  188.     
  189.     IF SameTextStyle(oldTextStyle, newTextStyle) &
  190.        (fAlignment = newAlign)
  191.     THEN
  192.         CreateTheCommand := NIL                            { no change }
  193.     ELSE IF (fAlignment = newAlign)
  194.     THEN
  195.         BEGIN
  196.         CreateTheCommand := TTEView(fView).DoMakeStyleCommand(
  197.                                                 newTextStyle,
  198.                                                 cCharacter,
  199.                                                 doAllAndAlign);
  200.         END
  201.     ELSE            { alignment changed; text style may have, too }
  202.         BEGIN
  203.         New(aCmd);
  204.         FailNIL(aCmd);
  205.         aCmd.ITEStyleAndAlignCmd(TTEView(fView),
  206.                                  newTextStyle,
  207.                                  fCmdNumber,
  208.                                  doAllAndAlign,
  209.                                  newAlign);
  210.     
  211.         CreateTheCommand := aCmd;
  212.         END;  { else }
  213.     END;  { CreateTheCommand }
  214.     
  215. {——————————————————————————————————————————————————————————————————————————————}
  216. {$S AFields}
  217.                 
  218. {$IFC qInspector}
  219. PROCEDURE TTECharDialogCmd.Fields(
  220.                         PROCEDURE DoToField(
  221.                             fieldName:        Str255;
  222.                             fieldAddr:        Ptr;
  223.                             fieldType:        INTEGER));
  224.                         OVERRIDE;
  225.     BEGIN
  226.     DoToField('TTECharDialogCmd', NIL, bClass);
  227.     
  228.     INHERITED Fields(DoToField);
  229.     END;  { Fields }
  230. {$ENDC qDebug}
  231.  
  232.  
  233. {###############################################################################
  234. TTEStyleAndAlignCmd
  235. ###############################################################################}
  236.  
  237. {——————————————————————————————————————————————————————————————————————————————}
  238. {$S ASelCommand}    
  239.         
  240. PROCEDURE TTEStyleAndAlignCmd.ITEStyleAndAlignCmd(
  241.                         itsTEView:            TTEView;
  242.                         itsTextStyle:        TextStyle;
  243.                         itsCmdNumber:        CmdNumber;
  244.                         itsMode:            INTEGER;
  245.                         itsAlignment:        INTEGER);
  246.     BEGIN
  247.     ITEStyleCommand(itsTEView, itsTextStyle, itsCmdNumber, itsMode);
  248.     
  249.     fOldAlignment := itsTEView.fJustification;
  250.     fNewAlignment := itsAlignment;
  251.     END;  { ITEStyleAndAlignCmd }
  252.  
  253. {——————————————————————————————————————————————————————————————————————————————}
  254. {$S ADoCommand}
  255.  
  256. PROCEDURE TTEStyleAndAlignCmd.DoIt;
  257.                         OVERRIDE;
  258.     BEGIN
  259.     INHERITED DoIt;
  260.     
  261.     IF (BAND(fMode, doAlign) <> 0) & (fNewAlignment <> fOldAlignment)
  262.     THEN
  263.         fTEView.SetJustification(fNewAlignment, kRedraw);
  264.     END;  { DoIt }
  265.  
  266. {——————————————————————————————————————————————————————————————————————————————}
  267. {$S ADoCommand}
  268.  
  269. PROCEDURE TTEStyleAndAlignCmd.UndoIt;
  270.     BEGIN
  271.     INHERITED UndoIt;
  272.     
  273.     IF (BAND(fMode, doAlign) <> 0) & (fNewAlignment <> fOldAlignment)
  274.     THEN
  275.         fTEView.SetJustification(fOldAlignment, kRedraw);
  276.     END;  { UndoIt }
  277.     
  278. {——————————————————————————————————————————————————————————————————————————————}
  279. {$S AFields}
  280.                 
  281. {$IFC qInspector}
  282. PROCEDURE TTEStyleAndAlignCmd.Fields(
  283.                         PROCEDURE DoToField(
  284.                             fieldName:        Str255;
  285.                             fieldAddr:        Ptr;
  286.                             fieldType:        INTEGER));
  287.                         OVERRIDE;
  288.     BEGIN
  289.     DoToField('TTEStyleAndAlignCmd', NIL, bClass);
  290.     
  291.     DoToField('fOldAlignment',     @fOldAlignment, bInteger);
  292.     DoToField('fNewAlignment',     @fNewAlignment, bInteger);
  293.     
  294.     INHERITED Fields(DoToField);
  295.     END;  { Fields }
  296. {$ENDC qDebug}
  297.     
  298. {——————————————————————————————————————————————————————————————————————————————}
  299.  
  300. *** EOF on both files ***
  301.